package com.emellend.api11.os;

import com.emellend.api11.R;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Vibrator;
import android.view.View;
import android.widget.EditText;

public class MorseCode extends Activity {
	private EditText mTextView;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.morse_code);
		findViewById(R.id.button).setOnClickListener(mListener);
		mTextView = (EditText) findViewById(R.id.text);
	}
	View.OnClickListener mListener=new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			String text=mTextView.getText().toString();
			long[] pattern=MorseCodeConverter.pattern(text);
			Vibrator vibrator=(Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
			vibrator.vibrate(pattern,-1);
		}
	};
	
}
